﻿using System;
namespace Producers.Arireg.Xtee.Riik.Ee.Producer.Arireg {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="toimiku_dokument_v2_Request", Namespace="http://producers.arireg.xtee.riik.ee/producer/arireg", Target=typeof(ToimikuDokumentV2Request))]
    public class ToimikuDokumentV2RequestSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IToimikuDokumentV2Request clazz;
        
        public ToimikuDokumentV2RequestSerializer(IToimikuDokumentV2Request clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("dokumendi_id");
            Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "integer");
            Writer.WriteString(new global::Xtee.Core.Schema.XsdInteger(((decimal)(clazz.DokumendiId))).ToString());
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="dokumendi_id") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>toimiku_dokument_v2_Request>dokumendi_id");
                }
                clazz.DokumendiId = new global::Xtee.Core.Schema.XsdInteger(Reader.ReadElementString("dokumendi_id")).Value;
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>toimiku_dokument_v2_Request>dokumendi_id", Reader.LocalName);
            }
        }
    }
}
